<?php
function &getService($class, $param = null) {
 
    static $instances; 

    if (!is_array($instances)) { 
        $instances = array(); 
    } 

    if (!isset($instances[$class])) { 
        $instances[$class] =& new $class($param); 
    } 

    return $instances[$class]; 
}
?>